/**
 * 
 */
package barney.davis.hume.it3048todo.dto;

import java.io.Serializable;
import java.util.Calendar;
import java.util.UUID;

import android.location.Location;
import barney.davis.hume.it3048todo.constants.TaskRepeat;
import barney.davis.hume.it3048todo.constants.TaskStatus;

/**
 * @author Adam
 * 
 */
public class Task implements Serializable{

	/**
	 * Create a new task. A unique identifier is automatically created every
	 * time a new task object is created using this no-arg constructor.
	 */
	public Task() {
		ID = UUID.randomUUID().toString();
		Location location = new Location((String)null);
		location.setLongitude(0.0);
		location.setLatitude(0.0);
		this.location = location;
	}

	/**
	 * Creates a new task. This method should only be used when retrieving a
	 * task from the database in order to preserve the unique identifiers for
	 * tasks, only created when creating a task using the no-arg constructor.
	 * 
	 * @param ID
	 * @param text
	 * @param dueDate
	 * @param complexity
	 * @param status
	 * @param repeat
	 */
	public Task(String ID, String text, Calendar dueDate, double complexity,
			TaskStatus status, TaskRepeat repeat, Location location, String locationLabel) {
		this.ID = ID;
		this.text = text;
		this.dueDate = dueDate;
		this.complexity = complexity;
		this.status = status;
		this.repeat = repeat;
		this.location = location;
		this.locationLabel = locationLabel;

	}

	public String ID;
	public String text;
	public Calendar dueDate;
	public double complexity;
	public TaskStatus status;
	public TaskRepeat repeat;
	public Location location;
	

	public String locationLabel;

	/**
	 * @return the text
	 */
	public String getText() {
		return text;
	}

	/**
	 * @param text
	 *            the text to set
	 */
	public void setText(String text) {
		this.text = text;
	}

	/**
	 * @return the dueDate
	 */
	public Calendar getDueDate() {
		return dueDate;
	}

	/**
	 * @param dueDate
	 *            the dueDate to set
	 */
	public void setDueDate(Calendar dueDate) {
		this.dueDate = dueDate;
	}

	/**
	 * @return the complexity
	 */
	public double getComplexity() {
		return complexity;
	}

	/**
	 * @param complexity
	 *            the complexity to set
	 */
	public void setComplexity(double complexity) {
		this.complexity = complexity;
	}

	/**
	 * @return the status
	 */
	public TaskStatus getStatus() {
		return status;
	}

	/**
	 * @param status
	 *            the status to set
	 */
	public void setStatus(TaskStatus status) {
		this.status = status;
	}

	/**
	 * @return the repeat
	 */
	public TaskRepeat getRepeat() {
		return repeat;
	}

	/**
	 * @param repeat
	 *            the repeat to set
	 */
	public void setRepeat(TaskRepeat repeat) {
		this.repeat = repeat;
	}

	/**
	 * @return the iD
	 */
	public String getID() {
		return ID;
	}
	
	/**
	 * @return the location
	 */
	public Location getLocation() {
		return location;
	}

	/**
	 * @param location the location to set
	 */
	public void setLocation(Location location) {
		this.location = location;
	}

	/**
	 * @return the locationLabel
	 */
	public String getLocationLabel() {
		return locationLabel;
	}

	/**
	 * @param locationLabel the locationLabel to set
	 */
	public void setLocationLabel(String locationLabel) {
		this.locationLabel = locationLabel;
		
	}
	
	/**
	 * Convenience method for DAO. Returns the latitude.
	 * @return the latitude
	 */
	public double getLatitude() {
		double rtrn = this.location.getLatitude();
		return rtrn;
	}

	/**
	 * Convenience method for DAO. Returns the longitude.
	 * @return the longitude.
	 */
	public double getLongitude() {
		double rtrn = this.location.getLongitude();
		return rtrn;
	}

}
